import com.zjz.dao.UserDaoImpl;
import com.zjz.service.UserService;
import com.zjz.service.UserServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

@SuppressWarnings("ALL")
public class Mytest {
    public static void main(String[] args) {

        // 获取ApplicationContext;拿到Spring容器
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");

        // 容器在手，天下我有，需要什么，就get什么！
        UserServiceImpl userServiceImpl = (UserServiceImpl)context.getBean("userServiceImpl");

        userServiceImpl.getUser();


        UserDaoImpl userDao = new UserDaoImpl();
        userDao.getUser();
















        /*

        // 用户实际调用的是业务层，dao层他们不需要接触
        UserService userService = new UserServiceImpl();

        userService.getUser();

       (new UserDaoImpl()).getUser();

*/


    }



}
